﻿<UserControl x:Class="MicroFlasher.Views.Settings.ComBitBangSettingsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:models="clr-namespace:MicroFlasher.Models"
             xmlns:settings="clr-namespace:MicroFlasher.Views.Settings"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance models:ComBitBangConfig}">
    <StackPanel Orientation="Vertical">
        <settings:ComPortSettingsView DataContext="{Binding Path=ComPortSettings}" />
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="2*"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Label Grid.Row="0" Grid.Column="0" Target="{Binding ElementName=ResetPin}">Reset PIN:</Label>
            <Label Grid.Row="1" Grid.Column="0" Target="{Binding ElementName=ClkPin}">CLK PIN:</Label>
            <Label Grid.Row="2" Grid.Column="0" Target="{Binding ElementName=MosiPin}">MOSI PIN:</Label>
            <Label Grid.Row="3" Grid.Column="0" Target="{Binding ElementName=MisoPin}">MISO PIN:</Label>

            <ComboBox Grid.Row="0" Grid.Column="1" x:Name="ResetPin"
                  ItemsSource="{StaticResource OuputComPins}" 
                  SelectedItem="{Binding Path=ResetPin.Pin, Mode=TwoWay}" />

            <ComboBox Grid.Row="1" Grid.Column="1" x:Name="ClkPin"
                  ItemsSource="{StaticResource OuputComPins}" 
                  SelectedItem="{Binding Path=ClkPin.Pin, Mode=TwoWay}" />

            <ComboBox Grid.Row="2" Grid.Column="1" x:Name="MosiPin"
                  ItemsSource="{StaticResource OuputComPins}" 
                  SelectedItem="{Binding Path=MosiPin.Pin, Mode=TwoWay}" />

            <ComboBox Grid.Row="3" Grid.Column="1" x:Name="MisoPin"
                  ItemsSource="{StaticResource InputComPins}" 
                  SelectedItem="{Binding Path=MisoPin.Pin, Mode=TwoWay}" />

            <CheckBox  Grid.Row="0" Grid.Column="2" IsChecked="{Binding Path=ResetPin.Invert}" Content="Invert"/>
            <CheckBox  Grid.Row="1" Grid.Column="2" IsChecked="{Binding Path=ClkPin.Invert}" Content="Invert"/>
            <CheckBox  Grid.Row="2" Grid.Column="2" IsChecked="{Binding Path=MosiPin.Invert}" Content="Invert"/>
            <CheckBox  Grid.Row="3" Grid.Column="2" IsChecked="{Binding Path=MisoPin.Invert}" Content="Invert"/>
        </Grid>
    </StackPanel>
</UserControl>
